﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.List" %>
<%@ page import="javax.servlet.http.HttpSession" %>
<%@ page import="com.jaxplat.commons.RowImpl" %>
<%
    String contextPath = request.getContextPath();
    String userId = (String)request.getSession().getAttribute("usessionid");
	List reservOrderList = null;
	List userContrctList = null;
	String pagingHtml = "";
	if(null != request.getAttribute("reserveOrderList")){
	    reservOrderList = (List)request.getAttribute("reserveOrderList");
	} else {
	    reservOrderList = new java.util.ArrayList();
	}
	if(null != request.getAttribute("userContrctList")){
	    userContrctList = (List)request.getAttribute("userContrctList");
	} else {
	    userContrctList = new java.util.ArrayList();
	}
	if(null != request.getAttribute("pagingHtml"))
	{
	    pagingHtml = (String)request.getAttribute("pagingHtml");
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="<%=session.getAttribute("keywords")%>" name="Keywords">
<meta content="<%=session.getAttribute("description")%>" name="description">
<title>预约管理-云南移动无线城市</title>
<link rel="stylesheet" type="text/css" href="<%=contextPath %>/css2/style.css">
<link rel="stylesheet" type="text/css"
	href="<%=contextPath %>/js/jquery-easyui-1.3/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="<%=contextPath %>/js/jquery-easyui-1.3/themes/icon.css">	
<script type="text/javascript" src="<%=contextPath %>/js/jquery-easyui-1.3/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="<%=contextPath %>/js/jquery-easyui-1.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=contextPath %>/js/jquery-easyui-1.3/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="<%=contextPath %>/js/common.js"></script>
<script type="text/javascript">
$().ready(function(){
	var flag=<%=request.getAttribute("flag")%>;
	if(flag==4){
		$("#onetothree").hide();
		$("#four").show();
	}else{
		$("#onetothree").show();
		$("#four").hide();
	}

});
function deleteContract(delUrl){
	$.messager.confirm(
			'提示',
			'您确定要删除此联系人吗？',
			function(result) {
				if (!result) {
					return;
				}
				
				//提交
				$.post(delUrl,
						null,
						function(resp) {
							var response = eval("(" + resp + ")");
							if(response.flag==4){
								$.messager.alert('提示','联系人删除成功!','info');
								window.location.reload();
							} else{
								$.messager.alert('提示','联系人删除失败!','error');
							}
						});
				
			});
}
function refundOrder(order_id){  
	    if(order_id==null || order_id=="")
	{
		return;
	}
	if(window.confirm('您确定要退号吗？')){
		 $(document).ready(function(){  
		        $.ajax({  
		                           url :'<%=request.getContextPath()%>/web2/reserveManageAction.do?method=refund&orderId='+order_id,  //后台处理程序  
		                           type:"post",    //数据发送方式  
		                          async:false,  
		                           dataType:"json",   //接受数据格式             
		                          error: function(){  
		                           alert("服务器没有返回数据，可能服务器忙，请重试");  
		                          },  
		                           success: function(json){  
		                             var response = eval(json); 
		                            if(response.errcode=='0')
									{
										alert('退号成功!');
										window.location.reload();
									}
									else
									{
										alert(response.message);
										window.location.reload();
									}		                       
								}   
						});                     
					});  
		
		 
		 
		}
		
	} 
	
	
function cancelOrder(order_id){  
	    if(order_id==null || order_id=="")
	{
		return;
	}
	if(window.confirm('您确定要退号吗？')){
		 $(document).ready(function(){  
		        $.ajax({  
		                           url :'<%=request.getContextPath()%>/web2/reserveManageAction.do?method=cancelOrder&orderId='+order_id,  //后台处理程序  
		                           type:"post",    //数据发送方式  
		                          async:false,  
		                           dataType:"json",   //接受数据格式             
		                          error: function(){  
		                           alert("服务器没有返回数据，可能服务器忙，请重试");  
		                          },  
		                           success: function(json){  
		                             var response = eval(json); 
		                           	alert(response.message);
									window.location.reload();                    
								}   
						});                     
					});  
		
		 
		 
		}
	else
	{
		return;
	}
		
} 


function doPagination(index)
{
	var url= '<%=contextPath%>/web2/reserveManageAction.do?method=reserverOrderList&browseFalg=web&flag=<%=request.getAttribute("flag")%>&page=' + index;
	location.href = url;
}

</script>

<!--[if IE 6]>
 <style type="text/css">
 .w942m {
	width:942px;
	margin:0 auto;
	margin-top:150px;
}
.main_left .main_box_title {
	background: url("../images/h4bg.png") no-repeat scroll left top transparent;
	height:43px;
	margin-left:-10px;
	position:absolute;
	top:10px;
}
 </style>
<![endif]-->

<!--[if IE 7]>
 <style type="text/css">
 .w942m {
	width:942px;
	margin:0 auto;
	margin-top:150px;
}
.main_left .main_box_title {
	background: url("../images/h4bg.png") no-repeat scroll left top transparent;
	height:43px;
	margin-left:-10px;
	position:absolute;
	top:10px;
}
 </style>
<![endif]-->

</head>
<body>
<%=request.getSession().getAttribute("headerContentWeb") %>
<div class="guahao">
  <%@ include file="head.jsp"%> 
  <div class="clear mb8"></div>
  <!--start main-->
  <div class="main w942m">
    <div class="main_left2 fl w150">
      <div class="main_box">
        <div class="main_box_title">
          <div class="titleleft fl"></div>
          <div class="right_titlemain fl">
            <h4 class="h4">预约管理</h4>
          </div>
          <div class="titleright fl"></div>
        </div>
        <div class="right_main_box_cont">
          <!--navlist开始-->
          <ul class="navlist">
            <li><a href="<%=contextPathHead %>/web2/reserveManageAction.do?method=reserverOrderList&flag=1&browseFalg=web">未支付预约</a></li>
            <li><a href="<%=contextPathHead %>/web2/reserveManageAction.do?method=reserverOrderList&flag=2&browseFalg=web">我的预约</a></li>
            <li><a href="<%=contextPathHead %>/web2/reserveManageAction.do?method=reserverOrderList&flag=3&browseFalg=web">历史预约</a></li>
            <li><a href="<%=contextPathHead %>/web2/reserveManageAction.do?method=reserverOrderList&flag=4&browseFalg=web">常用联系人</a></li>
          </ul>
          <!--navlist结束-->
        </div>
        <!--end left_main_box_cont-->
        <div class="right_box_bottom mb8"></div>
      </div>
      <!--end main_box-->
    </div>
    <!--end main_left-->
    <!-- 如果用户没登录则不显示 -->
    <%if(null == userId || "".equals(userId)){ %>
       <div class="right_main_box_cont" align="center"> 
        <ul class="navlist">
        <a href="<%=session.getAttribute("webLoginUrl")%>"><font size="3px"> <strong> 您还未登录，请登录</strong> </font></a>
        </ul>
       </div>
    <%}else { %>
    <div class="main_right2 fl w780">
      <div class="main_box_list">
        <div class="once_top"></div>
        <div class="right_main_box_cont">
          <div class="box_keylist">

            <div class="bc">
              <div class="list_table">
                <div class="apps_titleName"> 
                  <span class="apps_titleLeft">
                     <%if("1".equals(request.getAttribute("flag"))){ %>
                			未支付预约
		             <%}else if("2".equals(request.getAttribute("flag"))){ %>
		                                                     我的预约  
		             <%}else if("3".equals(request.getAttribute("flag"))){ %>  	
		                                                      历史预约
		       		 <%}else if("4".equals(request.getAttribute("flag"))){ %>  	
		                                                      常用联系人
		       		 <%} %>
                  </span> 
                </div>
                <table border="0" id="onetothree" width="100%" cellspacing="0" cellpadding="0"  style="table-layout:fixed;">
                  <thead>
                    <tr>
                      <th width="10%">订单编号 </th>
                      <th width="10%">患者姓名 </th>
                      <th width="10%">支付手机</th>
                      <th width="15%">医院 </th>
                      <th width="10%">科室及类别</th>
                      <th width="10%">医生</th>
                      <th width="10%">预约时间</th>
                      <th width="10%">支付状态</th>
                      <th width="10%" class="apps_firstth2">操作</th>
                    </tr>
                  </thead>
                  <tbody>
                 <%
				 for(int i=0; reservOrderList != null && i < reservOrderList.size();i++)
				 {
				     RowImpl row = (RowImpl) reservOrderList.get(i);
				 %>
                    <tr>
                      <!-- <td class="apps_firstth1"><input name="" type="checkbox" value="" /></td> -->
                      <td><%=row.get("orderId") %></td>
                      <td><%=row.get("applicantName")%></td>
                      <td><%=row.get("mobileNo") %></td>
                      <td><%=row.get("hospitalName") %></td>
                      <td><%=row.get("sectionName") %><br/><%=row.get("secType") %></td>
                      <td><%=row.get("doctorName") %></td>
                      <td><%=row.get("reserveTime") %></td>
                      <td><% if ("1".equals(row.get("payStatus").toString())) {%>
                          	 未付款
                           <%} else if("2".equals(row.get("payStatus").toString())){ %>	
                      		 已付款
                           <%} else if("3".equals(row.get("payStatus").toString())){%> 
                          	已退款
                           <%} %>
                      </td>
                    
                      <td >
                      <a href="<%=contextPathHead %>/web2/reserveManageAction.do?method=viewReserveOrder&orderId=<%=row.get("orderId")%>&flag=<%=request.getAttribute("flag")%>">查看</a>                        
                      </td>
                    </tr>
                 <%} %>
                  </tbody>
                </table>
                
                <!-- 常用联系人 -->
                 <table border="0" id="four" width="100%" cellspacing="0" cellpadding="0"  style="table-layout:fixed;">
                  <thead>
                    <tr>
                      <th width="20%">患者姓名 </th>
                      <th width="25%">身份证号码</th>
                      <th width="10%">性别 </th>
                      <th width="30%">住址 </th>
                      <th class="apps_firstth2">操作</th>
                    </tr>
                  </thead>
                  <tbody>
                <%
				 for(int i=0; userContrctList != null && i < userContrctList.size();i++)
				 {
				     RowImpl row = (RowImpl) userContrctList.get(i);
				 %>
                    <tr>
                      
                      <td><%=row.get("name") %></td>
                      <td><%=row.get("id_card_no") %></td>
                      <td><% if ("m".equals(row.get("sex").toString())) {%>
                          	 男
                           <%} else if (!"m".equals(row.get("sex").toString())){ %>
                           	女
                           <%} %>
                      </td>
                      <td><%=row.get("address") %></td>
                      <td >
	                      <input type="button" value="删除" onclick="deleteContract('<%=contextPathHead %>/web2/reserveManageAction.do?method=deleteUserContract&id=<%=row.get("id")%>&flag=<%=request.getAttribute("flag")%>')"/>
                      </td>
                    </tr>
                 <%} %>
                 
                 
                  </tbody>
                </table>
                
                
                <div class="pages">
                   <p class="page"><%=pagingHtml %></p>
                </div>
              </div>
              <div class="clear"></div>
            </div>
            <!--end bc-->
          </div>
          <!--end inbox-->
        </div>
        <!--end right_main_box_cont-->
        <div class="left_box_bottom mb8"></div>
      </div>
      <%} %>
      
      
      
      <!--end main_box-->
    </div>
    <!--end main_right-->
  </div>
  <!--end main_left-->
</div>
<!--end main-->
<div class="clear"></div>
  
<%=request.getSession().getAttribute("footerContentWeb") %>
</body>
</html>